(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.custAcct.viewController', viewController);
	viewController.$inject = [ '$scope', '$q', 'Constants', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'custAcctService', 'storageService' ];
	function viewController($scope, $q, Constants, layoutConfig, validatorConfig, gridService, authService, custAcctService, storageService) {
		var ctrl = this, custAcctInfo = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.custAcct = {};
		custAcctService.initFunction(ctrl);
		
		ctrl.init = function() {
			custAcctService.initOptions().then(function(response){
				ctrl.custAcctTypeOptions = response.custAcctTypeOptions;
				ctrl.ccyOptions = response.ccyOptions;
				ctrl.paycodeCatOptions = response.paycodeCatOptions;
				ctrl.allPartyTypeOptions = response.allPartyTypeOptions;
				ctrl.yesNoOptions = response.yesNoOptions;
				ctrl.yesNoOptionsb = response.yesNoOptionsb;
				ctrl.swiftCaseList = response.swiftCaseList;
				ctrl.accountPatterns = response.accountPatterns;
				ctrl.accountPatternsTwo = response.accountPatternsTwo;
				
				ctrl.partyCountrys = response.countryOptionAll;
				ctrl.partyStates = response.stateOptionAll;
				ctrl.partyCitys = response.cityOptionAll;
				ctrl.stateList = response.stateList;
				ctrl.cityList = response.cityList;
				ctrl.partyStatesCatch = response.stateOptionAll;
				ctrl.partyCitysCatch = response.cityOptionAll;
							
				authService.view(custAcctInfo).then(function(response) {
					ctrl.custAcct = response.data || custAcctInfo;
					ctrl.custAcct.siteCode = storageService.getUserInfo().siteCode;
					ctrl.initPyPartyTabs();
				}, angular.noop);
			});
		};
		
		
	}
})(angular);